﻿#if NETSTANDARD2_0 || NETCOREAPP3_0
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Options;
#endif
using System.Collections.Generic;

namespace Longbow.Cache
{
    /// <summary>
    /// CacheOptions 配置类
    /// </summary>
    internal class CacheOptions
    {
        /// <summary>
        /// 获得/设置 是否启用 默认 false
        /// </summary>
        public bool Enabled { get; set; }

        /// <summary>
        /// 获得/设置 CacheOption 缓存配置集合
        /// </summary>
        public IEnumerable<CacheOption> CacheItems { get; set; }

        /// <summary>
        /// 获得/设置 CacheOption 缓存配置集合
        /// </summary>
        public IEnumerable<CacheCorsItem> CorsItems { get; set; }
    }

#if NETSTANDARD2_0 || NETCOREAPP3_0
    /// <summary>
    /// 缓存配置类
    /// </summary>
    /// <typeparam name="TOptions"></typeparam>
    internal class CacheConfigureOptions<TOptions> : ConfigureFromConfigurationOptions<TOptions> where TOptions : class
    {
        /// <summary>
        /// 构造函数
        /// </summary>
        /// <param name="configuration"></param>
        public CacheConfigureOptions(IConfiguration configuration)
            : base(configuration.GetSection("LongbowCache"))
        {

        }
    }
#endif
}
